package com.itwk.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.itwk.common.valid.AddGroup;
import com.itwk.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 * 
 * @author wangke
 * @email wangke19970512@163.com
 * @date 2021-01-07 22:57:11
 */
@Data
@TableName("pms_brand")
public class PmsBrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message = "修改品牌必须携带id",groups = UpdateGroup.class)
	@Null(message = "新增品牌，id必须为空",groups = AddGroup.class) //ID全局自增，不生效
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空",groups = {UpdateGroup.class,AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "url地址必须为合法地址",groups = {UpdateGroup.class,AddGroup.class})
	@NotBlank(message = "logo地址不能为空",groups = {UpdateGroup.class,AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */

	@NotBlank(message = "产品描述不能为空",groups = {UpdateGroup.class,AddGroup.class})
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */

	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@Pattern(regexp = "^[a-zA-Z]$",message = "首字母必须为26个英文字母之一",groups ={UpdateGroup.class,AddGroup.class} )
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "排序必须大于0",groups ={UpdateGroup.class,AddGroup.class} )
	private Integer sort;

}
